

<include file="public@header" />
    <script src="__TMPL__/public/assets/js/jquery-1.10.2.min.js"></script>
    <script src="__STATIC__/js/layer/layer.js"></script>
    <meta charset="UTF-8">
    <title>Document</title>

</head>
<body>
<div>
    <!--<p>
        &lt;!&ndash;{:url('store/eache')}&ndash;&gt;
        <a href="{:url('store/eache')}" onclick="business()">添加套餐类别</a>
        <a href="#" onclick="onn()">添加商铺类别</a>

    </p>-->

    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <li><a href="{:url('store/eache')}" onclick="business()" style="height: 50px;width: 180px;font-size: 20px;background-color: #2C3E50">添加套餐类别</a></li>
            <li><a  href="" onclick="onn()" style="height: 50px;width: 180px;font-size: 20px;background-color: #2C3E50">添加商铺类别</a></li>
        </ul>
        <form action="#" method="post" enctype="multipart/form-data" id="form1" onsubmit="return false">
            <table class="table table-hover table-bordered">
                <thead>
                <tr>
                    <th width="left">商品类别</th>
                    <th align="left">套餐选择</th>
                    <th align="left">加盟费</th>
                    <th width="160">{:lang('ACTIONS')}</th>
                </tr>
                </thead>
                <tbody>
                <foreach name="data" item="vo">
                    <tr>
                        <td>
                            {$vo.cat_name}

                        </td>
                        <td>
                            {$vo.cat_goods}

                        </td>
                        <td>
                            {$vo.franchise_fee}

                        </td>
                        <td>
                            <input type="radio" name="nnn" value="{$vo.cat_name} {$vo.cat_goods} {$vo.franchise_fee}" id="checkbox1"  onclick="checkbox('{$vo.cat_goods}',this,'{$vo.id}')" />
                            <a href="{:url('Store/del',array('id'=>$vo['id']))}" onClick="return confirm('确定删除?');">删除</a>
                            <a href="{:url('Store/update',array('id'=>$vo['id']))}" >修改</a>
                        </td>
                    </tr>
                </foreach>

                </tbody>


                <table class="table table-hover table-bordered table-list">
                    <thead>
                    <tr>
                        <th width="50">排序</th>
                        <th width="50">ID</th>
                        <th>分类名称</th>

                    </tr>
                    </thead>
                    <tbody>
                    <volist name="usera" id="vo">

                        <tr id="aa">
                            <td id="a">
                                {$vo.type}
                            </td>
                            <td style="width: 600px; height:60px" id="a1">
                                <foreach name="useraaa" item="co">
                                    {$co}<input type="checkbox" name="check[]" value="{$co}" />
                                </foreach>
                            </td>
                            <td>
                                <a href="{:url('Store/mealupdate',array('id'=>$vo['b_id']))}">修改</a>
                                <!--<a href="{:url('Store/delmeal',array('id'=>$vo['b_id']))}" onClick="return confirm('确定删除?');">删除</a>-->
                            </td>
                        </tr>
                    </volist>

                    <volist name="userb" id="vo">
                        <tr id="bb">
                            <td id="b">
                                {$vo.type}
                            </td>
                            <td style="width: 600px; height:60px" id="b1">
                                <!--{$vo.goods}<input type="checkbox" name="check[]" value="{$vo.goods}" />-->
                                <foreach name="userbbb" item="co">
                                    {$co}<input type="checkbox" name="check[]" value="{$co}" />
                                </foreach>
                            </td>
                            <td>
                                <a href="{:url('Store/mealupdate',array('id'=>$vo['b_id']))}">修改</a>
                                <!--<a href="{:url('Store/delmeal',array('id'=>$vo['b_id']))}" onClick="return confirm('确定删除?');">删除</a>-->


                            </td>
                        </tr>
                    </volist>

                    <volist name="userc" id="vo">
                        <tr id="cc">
                            <td id="c">
                                {$vo.type}
                            </td>
                            <td style="width: 600px; height:60px" id="c1">
                                <foreach name="userccc" item="co">
                                    {$co}<input type="checkbox" name="check[]" value="{$co}" />
                                </foreach>

                            </td>
                            <td>
                                <a href="{:url('Store/mealupdate',array('id'=>$vo['b_id']))}" >修改</a>
                                <!--<a href="{:url('Store/delmeal',array('id'=>$vo['b_id']))}" onClick="return confirm('确定删除?');">删除</a>-->
                            </td>
                        </tr>
                    </volist>

                    </tbody>

                </table>

               <!-- <input type="button" value="提交" onclick="insert()"/>-->
                <button type="button" class="btn btn-primary js-ajax-submit"  onclick="insert()">提交</button>
            </table>
        </form>
    <script type="text/javascript">

            if($("#checkbox1").prop("checked",false)){
                function insert() {
                    $.ajax({
                        type: "post",//方法
                        //dataType: "json",//预期服务器返回的数据类型
                        url: "/blog/store/mel",//表单接收url
                        data: $('#form1').serialize(),
                        success: function (result) {
                            window.location.href="url";
                            console.log(result);//打印服务端返回的数据(调试用)
                            if (result.resultCode == 200) {
                                alert("SUCCESS");
                            }
                            ;
                        },
                        error : function() {
                            if($("#checkbox1").attr("checked")){
                                alert("请点击选择");
                                window.location.href="add";
                            }else{
                                alert("已经上传过此类店铺类型");
                                window.location.href="add";
                            }
                        }
                    });
                }
            }else{
                alert("没选中店铺类型")
            }
    </script>
    <script type="text/javascript">
        function checkbox(o,obj,id){
            if(obj.checked){
                if(o=='A' ){
                    $("#aa").css("background-color",'red');
                    $("#bb").css("background-color",'#FFF');
                    $("#cc").css("background-color",'#FFF');
                   // alert('A');

                }else{

                    if(o=='B'){
                        //alert("b")
                        $("#aa").css("background-color",'#FFF');
                        $("#bb").css("background-color",'red');
                        $("#cc").css("background-color",'#FFF');

                    }else{
                        if(o=='C'){
                            //alert("c");
                            $("#cc").css("background-color",'red');
                            $("#aa").css("background-color",'#FFF');
                            $("#bb").css("background-color",'#FFF');

                        }
                    }
                }

            }else{
                $("#ooo").css("display","none")
            }
        }

    </script>
</div>
</body>
</html>
<script>
    function onn(){
        $.ajax({
           url:'store/eache'
        });
        layer.open({
            type: 2,
            title: '商铺类别',
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['893px', '600px'],
            content: '{:url("store/index")}'//视图路径
        });
    }
</script>

<script src="__STATIC__/js/admin.js"></script>
<!--
<script>


    function business(){
        layer.open({
            type: 2,
            title: '套餐类别',
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['893px', '600px'],
            content: '//www.wyc.com/blog/store/business'//视图路径
        });
    }
</script>
-->
